﻿using System;
using System.Windows.Data;
using Com.Lancetinc.Evs.Helpers;

namespace Com.Lancetinc.Evs.WpfTools
{
    public class ReportCountToStateConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            if (value == null)
                return null;
            if (!int.TryParse(value.ToString(), out var count))
            {
                return null;
            }

            return count == 0 ? I18nHelper.Default.GetMessage("ReportState.NotPrinted") : 
                I18nHelper.Default.GetMessage("ReportState.Printed");
        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            throw new NotSupportedException();
        }
    }
}
